home *** CD-ROM | disk | FTP | other *** search
- Path: soap.news.pipex.net!pipex!usenet
- From: m.hendry@dial.pipex.com (Mathew Hendry)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: BatchFile Params
- Date: Wed, 31 Jan 96 14:29:30
- Organization: Private node.
- Distribution: world
- Message-ID: <19960131.476320.D1B0@an181.du.pipex.com>
- References: <DM1KJo.7z4@info.swan.ac.uk>
- NNTP-Posting-Host: an181.du.pipex.com
- X-Newsreader: TIN [AMIGA 1.3 950726BETA PL0]
-
- Your Name Here (your.E-Mail.name@Swansea.ac.uk) wrote:
- ^^^^^^^^^^^^^^
-
- Oh dear, what were your parents thinking? ;)
-
- : can somebody please tell me how to pass command line parameters into
- : a batch file
- :
- : For example on the PC, the first parameter is %1, 2nd is %2 etc...
- : (BUT HOW DO YOU DO THIS ON THE AMIGA???)
- :
- : This would make my life a hell of a lot easier if there is a way,
- :
- : I've tried $1,$2, etc
-
- At the beginning of your script, include something like the following (this
- example is taken from the standard S:SPAT script)
-
- .key COM/A,PAT/A,OPT1,OPT2,OPT3,OPT4
- .bra {
- .ket }
-
- The .key line indicates the format of the command line arguments - up to six
- arguments in this case, only two of which are compulsory, as indicated by
- their /A suffix. There are a number of other possible suffixes, which may
- be combined, though I can't remember all of these offhand.
-
- The .bra and .ket lines tell the script interpreter how to delimit references
- to these arguments. The COM argument would be referenced by {COM} in this
- case. The delimiters are, by default, < and >.
-
- Further down the script we have:
-
- List >T:q{$$} {PAT} LFORMAT "{COM} *"%s%s*" {OPT1} {OPT2} {OPT3} {OPT4}"
-
- which uses all the arguments passed to the script.
-
- {$$} contains the current shell process number.
-
- So if you typed "SPAT munch #?.food taste chew mangle swallow" in shell process
- 6, the above line in the SPAT script would be executed as:
-
- List >T:q6 #?.food LFORMAT "munch *"%s%s*" taste chew mangle swallow"
-
- -- Mat.
-